HTML <input> type Attribute Examples
Example: In this example we have HTML form for username and password input with submit and reset buttons. Input type attributes: “text” for username, “password” for password.
<!DOCTYPE html>
<html>
<body>
<h3>HTML input type Attribute</h3>
<form action="#" method="get">
Username: <input type="text" name="uname">
<br><br>
Password: <input type="password" name="pwd">
<br><br>
<button type="submit" value="submit">
Submit
</button>
<button type="reset" value="reset">
Reset
</button>
</form>
</body>
</html>
Output:
Supported Browsers: The browsers supported by HTML <input> type attribute are listed below:
HTML type Attribute
The HTML <input> type Attribute is used to specify the type of <input> element to display. The default type of <input> type attribute is text.
Syntax:
<input type="value">
Attribute Values:
Name | Description |
---|---|
Defines clickable button in HTML document, commonly activated with JavaScript scripts. | |
HTML input field for selecting one or more limited options. | |
It is used to define a color picker. The value should be a seven-character hexadecimal notation. Its default value is #000000(black). | |
HTML input element for selecting dates with year, month, and day. | |
HTML field for entering email addresses, automatically validated for format. | |
It is used to specify the file select field and add a button to choose a file for upload to the form. | |
Hidden field: Input element in forms, conceals data from users, facilitating backend operations without user interaction, typically for database updates. | |
It is used to define an image as the submit button. | |
It is used to specify the control of month and year field. The value must be in the format of “YYYY-MM”. | |
It is used to specify an input field for entering a number. | |
Input tag attribute for sensitive data; should be transmitted securely (HTTPS) due to its sensitivity. | |
input element with type=radio, allows single selection from predefined options in forms. | |
Control for user-entered numbers, allows setting restrictions, default range typically 0 to 100. | |
It is used to defines a reset button. The reset button is used to reset all the form values to its initial values. | |
It is used to define a text field that entered a search string. | |
Triggers submission of user-input values to form handler, typically activating server-side processing script. | |
It is used to define a field that entering a user telephone Number. | |
It is used to define a single-line text field . The default width of the text field is 20 characters. | |
It is used to specify the entering time control field. | |
It is used to define a field that entered a URL. This input value is automatically validated before submitted the form. | |
It is used to define a week and a year control field. |